PtrToHand
PtrToHand
Create new Handle and copy data into it #include <OSUtils.h> Operating System Utilities
Ptr srcPtr ; address of some data to copy Handle *destHandle ; receives handle to copy of data long size ; length, in bytes, of data to copy
PtrToHand creates a new Handle to a relocatable block of memory (as in srcPtr is the address of some data.
destHandle is the address of a 4-byte Handle. Upon return, it will contain a
Handle leading to a relocatable block of memory that is size bytes
long and contains a copy of the data starting at srcPtr.
size is the size, in bytes, of the data you wish to copy.
memFullErr (-108) Not enough room in heap for new Handle
Notes: Since destHandle is created by PtrToHand, it should be an unassigned Handle before the call. For instance, the following code allocates a 68-byte
relocatable block and sets Handle to point to its master pointer. It then
copies the arrow cursor into that new block.